
def try_code(data):
    try:
        temp = data.decode("utf-8")
    except:
        temp = data.decode("GBK")
        
    return temp




if __name__ == '__main__' :
    
    #测试一下
    test1 = "你好".encode("utf-8")
    test2 = "好的".encode("GBK")
    
    print(try_code(test1))
    print(try_code(test2))